const Koa = require('koa');
const koaStatic = require('koa-static');
const {
  resolve
} = require('path');

const koa = new Koa();
const proxy = require('koa-proxies');

// 静态资源访问
koa.use(koaStatic(resolve(__dirname, '')));
koa.use(proxy(
  '/sts', {
    target: 'http://172.16.8.209:3043/v1/alists',
    changeOrigin: true,
    rewrite(path) {
      return path.replace('/sts', '')
    }
  }
));
koa.listen(5555, (err) => {
  if (err) {
    console.log(err);
    return
  }
  console.log('port:5555');
});